package cn.iocoder.yudao.module.measure.service.protocol.impl;

import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.measure.dal.dataobject.protocol.TemplateDeviceUploadProtocol;
import cn.iocoder.yudao.module.measure.dal.mysql.protocol.TemplateDeviceUploadProtocolMapper;
import cn.iocoder.yudao.module.measure.service.protocol.TemplateDeviceUploadProtocolService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;

import javax.annotation.Resource;

/**
 * <p>
 * 业务实现类
 * 数据上传协议配置-主表
 * </p>
 *
 * @author zhengbzh
 * @date 2025-05-22 13:51:07
 * @create [2025-05-22 13:51:07] [zhengbzh] [代码生成器生成]
 */
@Slf4j
@RequiredArgsConstructor
@Service
@Validated
@Transactional(readOnly = true)
public class TemplateDeviceUploadProtocolServiceImpl  implements TemplateDeviceUploadProtocolService {

    @Resource
    private TemplateDeviceUploadProtocolMapper templateDeviceUploadProtocolMapper;


//    @Override
//    public TemplateDeviceUploadProtocol getDeviceProtocol(Long deviceId) {
//        return baseMapper.getByDeviceId(deviceId);
//    }

    @Override
    public TemplateDeviceUploadProtocol getMeasurePointProtocol(String regId) {
        TenantContextHolder.setIgnore(true); // 设置忽略租户信息
        log.debug("getMeasurePointProtocolByRegId {}", regId);
        TemplateDeviceUploadProtocol p = templateDeviceUploadProtocolMapper.getProtocolByUploadRegId(regId);
        log.debug("getMeasurePointProtocol {}", p);
        return p;
    }


//    @Override
//    public Map<Serializable, Object> findByIds(Set<Serializable> ids) {
//        return CollHelper.uniqueIndex(superManager.listByIds(ids), TemplateDeviceUploadProtocol::getId, TemplateDeviceUploadProtocol::getProtocolName);
//    }
}


